package apiday03homework;
import collection.Point;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo2 {
    public static void main(String[] args) {
        /*
        Collection<Point> c = new ArrayList<>();
        c.add(new Point(1, 2));
        c.add(new Point(3, 4));
        c.add(new Point(5, 6));
        c.add(new Point(7, 8));
        c.add(new Point(9, 0));
        boolean b = c.add(new Point(1, 2));
        System.out.println(b);
        System.out.println("c:"+c);

        Point p = new Point(1, 2);
        boolean b1 = c.contains(p);
        System.out.println(b1);

        boolean b2 = c.remove(p);//删除第一次匹配的
        System.out.println(b2);
        System.out.println("c:"+c);

         */
        Collection<Point> c = new ArrayList<>();
        c.add(new Point(1, 2));
        c.add(new Point(3, 4));
        c.add(new Point(5, 6));
        c.add(new Point(7, 8));
        c.add(new Point(9, 0));
        System.out.println("c:"+c);

        Point p = new Point(1, 2);
        System.out.println(c.contains(p));
        System.out.println("c" + c);
        System.out.println(c.remove(p));
        System.out.println("c:"+c);

        Point p1 = new Point(1, 2);
        c.add(p1);
        System.out.println("c:"+c);
        p1.setX(100);
        // c.add(p1);
        System.out.println("c:"+c);

    }
}
